# 设置代理地址
function set_proxy_config() {
    # 配置代理服务地址
    export http_proxy=http://192.168.10.1:17890
    export https_proxy=http://192.168.10.1:17890
    export no_proxy=127.0.0.1,localhost
    export HTTP_PROXY=http://192.168.10.1:17890
    export HTTPS_PROXY=http://192.168.10.1:17890
    export NO_PROXY=127.0.0.1,localhost
    echo -e "\033[32m[√] 已开启代理\033[0m"
}

# 取消配置代理地址
function unset_proxy_config() {
    # 取消配置代理服务地址
    unset http_proxy
    unset https_proxy
    unset no_proxy
    unset HTTP_PROXY
    unset HTTPS_PROXY
    unset NO_PROXY
    echo -e "\033[31m[×] 已关闭代理\033[0m"
}

# 开启系统代理
function proxy_on() {
    set_proxy_config
}

# 关闭系统代理
function proxy_off(){
    unset_proxy_config
}

function proxy_status(){
    echo -e "\033[31m代理配置\033[0m"
    echo "http_proxy=$http_proxy"
    echo "https_proxy=$https_proxy"
    echo "HTTP_PROXY=$HTTP_PROXY"
    echo "HTTPS_PROXY=$HTTPS_PROXY"
}
